﻿using log4net.Config;
using MiniFox.Components;
[assembly: XmlConfigurator(ConfigFile = "log4net.config")]
namespace MiniFox.Log
{
    /// <summary>
    /// 
    /// </summary>
    [AutoResolve]
    public class DefaultLoggerFactory : LoggerFactory
    {
        static DefaultLoggerFactory()
        {
            InitializeLogConfig();
        }
        /// <summary>
        /// 
        /// </summary>
        public static void InitializeLogConfig()
        {
            //XmlConfigurator.Configure();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public override ILogger CreateLogger(string name)
        {
            if (LoggerConfig == null || string.IsNullOrWhiteSpace(name))
                return new Logger();
            var setting = LoggerConfig.LoggerSettings[name];
            return new Logger(setting);
        }


    }
}
